package com.jn.news.ui.fragment;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.jn.news.R;
import com.jn.news.ui.JuheNewsListActivity;
import com.jn.news.utils.Constant;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link JuheNewsFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class JuheNewsFragment extends Fragment {


    public static JuheNewsFragment newInstance(int position) {
        JuheNewsFragment fragment = new JuheNewsFragment();
        Bundle args = new Bundle();
        args.putInt("position", position);
        fragment.setArguments(args);
        return fragment;
    }



    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
         View view =  inflater.inflate(R.layout.fragment_wangyi_news, container, false);
         initView(view);
         return view;
    }
    private void initView(View view) {
        view.findViewById(R.id.rl_entertainment).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), JuheNewsListActivity.class);
                intent.putExtra(Constant.NEWS_TYPE,"yule");
                startActivity(intent);
            }
        });
        view.findViewById(R.id.rl_sport).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), JuheNewsListActivity.class);
                intent.putExtra(Constant.NEWS_TYPE,"tiyu");
                startActivity(intent);
            }
        });
    }
}